﻿namespace CodedUITests
{
    using System;
    using System.Collections.Generic;
    using System.CodeDom.Compiler;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
    using System.Drawing;
    using System.Windows.Input;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITesting.WpfControls;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    public partial class UIMap
    {
        public void RunBuildAnalysisAndCloseManual()
        {
            #region Variable Declarations
            WpfButton uIValidateURIButton = this.UIWpfWindow.UIValidateURIButton;
            WpfButton uIBuildAnalysisButton = this.UIWpfWindow.UIBuildAnalysisButton;
            WinButton uICloseButton = this.UIBuildAnalysisWindow1.UICloseButton;
            WinButton uICloseButton1 = this.UIItemWindow.UICloseButton;
            #endregion

            // Click 'Validate URI' button
            Mouse.Click(uIValidateURIButton);

            ClickButton(uIBuildAnalysisButton);

            // Click 'Close' button
            Mouse.Click(uICloseButton);

            // Click 'Close' button
            Mouse.Click(uICloseButton1);
        }

        private void ClickButton(WpfButton button)
        {
            button.WaitForControlEnabled(30000);                        
            Mouse.Click(button);
        }
    }
}